package com.loklok.confuse.model;

import com.alibaba.fastjson.JSONArray;
import com.intellij.util.xmlb.Converter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * @Classname ConfigSettingConverter
 * @Description
 * @Date 2023/5/15 20:34
 * @Created by wangchangjiu
 */
public class LoadCodeConfigConverter extends Converter<List<ConfuseConfig.LoadFullCodeConfig>> {

    @Override
    public @Nullable List<ConfuseConfig.LoadFullCodeConfig> fromString(@NotNull String value) {
        return JSONArray.parseArray(value, ConfuseConfig.LoadFullCodeConfig.class);
    }

    @Override
    public @Nullable String toString(@NotNull List<ConfuseConfig.LoadFullCodeConfig> value) {
        return JSONArray.toJSONString(value);
    }
}
